<?php
/**
 * JoiGallery - image gallery component for Joostina
 *
 * Перемещение изображений
 *
 * @version 1.0 alpha 12
 * @package JoiGallery
 * @subpackage	AdminView
 * @filename item_move.php
 * @author JoostinaTeam
 * @copyright (C) 2008-2009 Joostina Team
 * @license see license.txt
 *
 **/
 
defined('_VALID_MOS') or die();

//Загружаем FancyBox
if ($params->get('adm_img_list_thumbs_fb')) {
mosCommonHTML::loadJqueryPlugins('fancybox/jquery.fancybox',false, true);
}
?>

<script language="javascript" type="text/javascript">
  function submitbutton(pressbutton) {
      var form = document.adminForm;
       if (pressbutton == 'cancel') {
              submitform( pressbutton );
              return;
      } 
      if (pressbutton == 'savemove') {//alert($("#catid option:selected").val());              
              if ($("#catid option:selected").val()==0) {
                alert('<?php echo _C_JOIGALLERY_MSG_CATEGORY_NO_NAME_MOVE; ?>');				
                $("form").submit(function () { return false; });
              }
              else {
                submitform(pressbutton);
              }
      }
      
  }

</script>   


<table class="adminheading">
  <tr>
    <th class="config">
     <?php echo _C_JOIGALLERY_COMPONENT._C_JOIGALLERY_MOVE_ITEMS; ?>
    </th>
  </tr>
</table>

<form action="index2.php" method="post" name="adminForm" id=name="adminForm">
  <table class="adminheading" border="1">
    <tr>
      <tr>
        <td width="140"><?php echo '<span class="gray">'._C_JOIGALLERY_PHOTO_MOVE_CAT.':</span> ' ?></td>
        <td><?php echo $lists['cid']; ?></td>
      </tr>
    </tr>
  </table>  
  <table class="adminlist">
    <tr>
      <th width="10" style="text-align: center">#</th>
      <th width="20"><input type="checkbox" name="toggle" value="" checked="checked" onClick="checkAll(<?php echo count( $rows );?>);" /></th>
      <?php if ($params->get('adm_img_list_thumbs')) { ?>
        <th class="title acenter" width="1">
          <img src="<?php echo _JOI_GALLERY_ADMIN_SITE ?>/icons/photos.png"
               border="0" width="16" height="16" alt="" />
        </th>
      <?php }//if ?>
      <th class="title"><?php echo _C_JOIGALLERY_NAME ?></th>
      <th class="title"><?php echo _C_JOIGALLERY_CATEGORY_CURRENT ?></th>
    </tr>

    <?php    
    $name = 'cid';
    $k = 0;
    for ($i=0, $n=count( $rows ); $i < $n; $i++) {
         $row  = &$rows[$i];
         $link = 'index2.php?option='.$option.'&act=photos&task=edit&hidemainmenu=1&cid='.$row->id;
    ?>

    <tr class="row<?php echo $k; ?>">
      <td align="right"><?php echo $pageNav->rowNumber( $i ); ?></td>
      <td><?php //echo mosHTML::idBox($i, $row->id); ?>
        <?php echo '<input type="checkbox" id="cb'.$i.'"
                           name="'.$name.'[]"
                           value="'.$row->id.'"
                           checked="checked"
                           onclick="isChecked(this.checked);" />'; ?>

      </td>
      <?php if ($params->get('adm_img_list_thumbs')) { ?>
        <td>          	  
			<?php if ($params->get('adm_img_list_thumbs_fb')) { ?>
			  <a class="thumb" target="_blank" rel="all" href="<?php echo JPATH_SITE.$params->original_path.'/'.$row->path; ?>" title="<?php echo $row->name; ?>">
                <?php    echo joiGalleryHelper::imgThumb ($thumb_source, $row->path, $params, 'item_list'); ?>
			  </a>
			<?php } else echo joiGalleryHelper::imgThumb ($thumb_source, $row->path, $params, 'item_list'); ?>          
        </td>
      <?php }//if ?>  
      <td>
        <a href="<?php echo $link; ?>">
          <?php echo  $row->name ; ?>
        </a>
      </td>
      <td><?php echo $photos->get_cat_field_by_photo($row->id); ?></td>
      
    </tr>

    <?php
    $k = 1 - $k;
  }//for
  ?>
  </table>
  
  <div class="adminlistfooter">
   <?php echo $pageNav->getListFooter(); ?>
  </div>

  <input type="hidden" name="option" value="<?php echo $option; ?>" />  
  <input type="hidden" name="task" value="savemove" />
  <input type="hidden" name="act" value="photos" /> 
  <input type="hidden" name="hidemainmenu" value="0" />
  <input type="hidden" name="boxchecked" value="1" /> 

</form>

<script type="text/javascript">
  $("a.thumb").fancybox();
</script>